﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Xml;

namespace PosrednikStoritev
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Posrednik : IPosrednik
    {
        public string[] Sinf_StukProg()
        {
            Sinf_StukProg.cir2012SiNf_StukProg ssp = new Sinf_StukProg.cir2012SiNf_StukProg();
            XmlNode[] vrniProgram = (XmlNode[])ssp.vrniProgramDogajanja().@return;
            string[] poljeVnosov=new string[vrniProgram[5].ChildNodes.Count];
            int stevec=0;
            foreach(XmlNode node in vrniProgram[5].ChildNodes)
            {
                poljeVnosov[stevec] = node.InnerText;
                stevec++;
            }
            return poljeVnosov;
        }

        public string[] Sinf_UMNews()
        {
            Sinf_UMNews.cir2012SiNf_UMNews sumn = new PosrednikStoritev.Sinf_UMNews.cir2012SiNf_UMNews();
            XmlNode[] vrniNovice = (XmlNode[])sumn.SiNf_UMNews().@return;
            string[] poljeVnosov = new string[vrniNovice.Length-5];
            int stevec = 0;
            foreach (XmlNode node in vrniNovice)
            {
                if (stevec >= 5)
                {
                    poljeVnosov[stevec - 5] = node.InnerText;
                }
                stevec++;
            }
            return poljeVnosov;
        }
    }
}
